package color
{
	import flash.geom.Vector3D;
	/**
	 * @author Nicolas Barradeau
	 * http://en.nicoptere.net
	 */
	public class ARGB
	{
		
		private var _a:int;
		private var _r:int;
		private var _g:int;
		private var _b:int;
		
		public function ARGB( a:int, r:int, g:int, b:int ) 
		{
			this.a = a;
			this.r = r;
			this.g = g;
			this.b = b;
		}
		
		public function normalize():Vector3D
		{
			return new Vector3D( r / 0xFF, g / 0xFF , b / 0xFF );
		}
		
		
		public function get a():int { return _a; }
		
		public function set a(value:int):void 
		{
			_a = value;
		}
		
		public function get r():int { return _r; }
		
		public function set r(value:int):void 
		{
			_r = value;
		}
		
		public function get g():int { return _g; }
		
		public function set g(value:int):void 
		{
			_g = value;
		}
		
		public function get b():int { return _b; }
		
		public function set b(value:int):void 
		{
			_b = value;
		}
		
		public function get color():uint 
		{ 
			return a << 24 | r << 16 & 0xFF | g << 8 & 0xFF | b & 0xFF; 
		}
		
		public function set color(value:uint):void 
		{
			a = value >> 24;  
			r = value >> 16 & 0xFF;  
			g = value >> 8 & 0xFF;  
			b = value & 0xFF;
		}
		
	}

}